package phone.example.com.a36kr.adapter.registerviewpageradapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import java.util.ArrayList;

/**
 * Created by dllo on 16/8/26.
 */
public class RegisterViewPager extends FragmentPagerAdapter{

    private ArrayList<Fragment> fragments;
    private ArrayList<String> list = new ArrayList<>();


    public void setFragments(ArrayList<Fragment> fragments) {
        this.fragments = fragments;
        list.add("登录");
        list.add("注册");
    }

    public RegisterViewPager(FragmentManager fm) {
        super(fm);
    }

    @Override
    public Fragment getItem(int position) {
        return fragments.get(position);
    }

    @Override
    public int getCount() {
        return fragments == null ? 0 :fragments.size();
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return list.get(position);
    }
}
